<template>
    <div>
        <div class="zxzx-item" v-for="(item,index) in list" :key='index' @click="toDetailes(item.id)">
            <p class="news-title">{{item.title}}</p>
            <p class="news-cont">{{item.content}}</p>
            <p class="news-time">{{item.create_time}}</p>
        </div>
    </div>
</template>
<script>
import { format, strFormat } from '../../public/utils';
export default {
    data () {
        return {
            list:'',
        }
    },
    mounted () {
        this.apiIndustry();
    },
    methods: {
        async apiIndustry(){
            let {data} = await this.https.get(this.api.apiIndustry);
            data.forEach(element => {
                element.create_time = format(element.create_time);
                element.title = strFormat(element.title,40);
                element.content = strFormat(element.content,180);
            });
            this.list = data;
        },

        toDetailes(id){
            this.$store.commit('setTitle',"最新资讯");
            this.$router.push(`/info/${id}`);
        }
    }
}
</script>
<style lang="less" scoped>
@import url(../../assets/css/industryinfo/viewzxzx.less);
</style>


